function AddOptions()
  {
	var currentNum =   $("div.layui-form-item").length-8;
	var coloneObject = $("#colone_item").clone();
	var button = $(coloneObject).find("button");
	 
	 var lebel = $(coloneObject).find("label");
	 $(lebel).text("选项"+currentNum);
	
	 $(button).removeClass("layui-btn-disabled");
	 $(button).removeAttr('disabled');
	 $("#addButtonItem").before(coloneObject);
	 
	 QuestionNameSort();
	 removeAllQuestions();
	 CreateQuestions(currentNum);
	
  }
  
  function RemoveOption(target)
  {
	
	 var parent =  $(target).parent();
	 parent =  $(parent).parent();
	 $(parent).remove();
	 
	 var currentNum =   $("div.layui-form-item").length-9;
	 removeAllQuestions();
	 CreateQuestions(currentNum);
	 QuestionNameSort();
  }
  
  function CreateQuestions(num)
  {
	  //复制复选框
	  for(i = 0; i < num; i++)
	  {
		  // console.log(i);
		   var question =  $(colonequstion).clone();
		   
		   $(question).attr("type","checkbox");
		   $(question).attr("title","选项"+(i+1));
		   $(question).attr("name","checkBoxItem");
			$(question).attr("value",i);
		    $(question).removeAttr("id");
		    $(checkboxdiv).append(question);
	  }
	  
	 
	  for(i = 0; i < num; i++)
	  {
		   var _question =  $(colonequstion).clone();
		   if(i==0)
		   {
			    $(_question).attr("checked","");
		   }
		   $(_question).attr("type","radio");
		   $(_question).attr("name","radioItem");
		   $(_question).attr("title","选项"+(i+1));
		    $(_question).attr("value",i);
		    $(_question).removeAttr("id");
		   $(radiodiv).append(_question);
	  }
	  
	 _form.render();
	 
  }
  
  //清除选项
  function removeAllQuestions()
  {
	  $(radiodiv).empty();
	  $(checkboxdiv).empty();
  }
  
  function QuestionNameSort()
  {
  	  //按照名称匹配
  	 var  array= $("div[name^='question_item']");
  	 for(i=0;i<array.length;i++)
  	 {
  		$(array[i]).find("label").text("选项"+(i+1));
  	 }
  	  
  }
  